#include "ObjectModel.h"

std::auto_ptr<ObjectModel> ObjectModel::m_instance;

bool ObjectModel::serialize( const std::string& path ) const
{
  bool result = true;
  result = result && m_committees->serialize(path + "/committees.csv");
  result = result && m_councilMembers->serialize(path + "/council_members.csv");
  result = result && m_membershipHistory->serialize(path + "/membership_history.csv");
  result = result && m_chairmanshipHistory->serialize(path + "/chairmanship_history.csv");
  result = result && m_sessions->serialize(path + "/sessions.csv");
  result = result && m_sessionPresences->serialize(path + "/session_presence.csv");
  return result;
}

bool ObjectModel::deserialize( const std::string& path )
{
  bool result = true;
  result = result && m_committees->deserialize(path + "/committees.csv");
  result = result && m_councilMembers->deserialize(path + "/council_members.csv");
  result = result && m_membershipHistory->deserialize(path + "/membership_history.csv");
  result = result && m_chairmanshipHistory->deserialize(path + "/chairmanship_history.csv");
  result = result && m_sessions->deserialize(path + "/sessions.csv");
  result = result && m_sessionPresences->deserialize(path + "/session_presence.csv");
  return result;
}

void ObjectModel::clear()
{
  m_committees->clear();
  m_councilMembers->clear();
  m_membershipHistory->clear();
  m_chairmanshipHistory->clear();
  m_sessions->clear();
  m_sessionPresences->clear();
}